package com.example.questionnaire.validate;

import com.example.questionnaire.exception.IllegalException;

import java.util.regex.Pattern;

public class UserValidate {
    public static void validateUsername(String username) {
        if (!Pattern.matches("\\w{6,12}", username)) {
            throw new IllegalException("username");
        }
    }

    public static void validatePassword(String password) {
        if (!Pattern.matches("\\w{6,12}", password)) {
            throw new IllegalException("password");
        }
    }
}
